namespace cpp crawler.server

exception ServerError {
  1:string why,
}
enum PageStatus {
  kNotYetDownload,
  kFailedToDownload,
  kSuccessDownload,
  kRedirected,
}
struct Link {
  1:string  url,
  2:string  anchor,
  3:i32     link_info,
}
struct Page {
  1:string  url,
  2:string  to_url,
  3:string  content,
  4:i64     download_time = 0,
  5:i16     http_code = 0,
  6:i32     status = PageStatus.kNotYetDownload,
}
struct Progress {
  1:i32 total_urls,
  2:i32 downloaded_urls,
  3:list<string> url_list,
}
service CrawlerServer {
  string   GetDownloadUrl() throws (1:ServerError error)
  Page     GetStoredPage(1:string url) throws (1:ServerError error)
  void     SendPage(1:Page page) throws (1:ServerError error)
  Progress GetProgress() throws (1:ServerError error)
}

